package com.cloud.class04.service.impl;

import com.cloud.class04.entities.Pay;
import com.cloud.class04.mapper.PayMapper;
import com.cloud.class04.service.PayService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @ClassDescription:
 * @JdkVersion: 17
 * @Author: yxy
 * @Created: 2024/4/7 17:08
 */
@Service
public class PayServiceImpl implements PayService {


    @Autowired
    PayMapper payMapper;
    @Override
    public int add(Pay pay) {
        int insert = payMapper.insert(pay);
        return insert;

    }

    @Override
    public int delete(Integer id) {
        int delete = payMapper.deleteByPrimaryKey(id);
        return delete;
    }

    @Override
    public int update(Pay pay) {

        int update = payMapper.updateByPrimaryKeySelective(pay);
        return update;
    }

    @Override
    public Pay getById(Integer id) {
        Pay pay = payMapper.selectByPrimaryKey(id);
        return pay;
    }

    @Override
    public List<Pay> getAll() {
        List<Pay> payList = payMapper.selectAll();
        return payList;
    }
}
